package sctu.edu.java.year2016.team07.shihaocheng.day20160605.chapter11_2;

import sctu.edu.java.year2016.team07.shihaocheng.day20160605.chapter11_1.*;

import java.lang.Exception;
import java.util.Scanner;

/**
 * Created by admin on 2016/6/5.
 */
public class Client {
    public static double count(double a, double b) throws Exception {

        if (a == 0 && b == 0) {
            throw new Exception("a and b cant be 0!");
        }
        return a * b;
    }


    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("输入a的值：");
        int a = scan.nextInt();
        System.out.print("输入b的值：");
        int b = scan.nextInt();
        try{
            double num = count(a,b);
            System.out.println("a*b="+num);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("a="+a+" "+"b="+b);
        }
    }
    }

